//
//  HomeCommendClubCell.m
//  Shengzhuli
//
//  Created by FXGuo on 2018/3/14.
//  Copyright © 2018年 kamangkeji. All rights reserved.
//

#import "HomeCommendClubCell.h"
#import <UIImageView+WebCache.h>
#import "NSDate+Extension.h"

@interface HomeCommendClubCell()
@property (weak, nonatomic) IBOutlet UIImageView *imgView;
@property (weak, nonatomic) IBOutlet UILabel *nameLab;
@property (weak, nonatomic) IBOutlet UILabel *desLab;
@property (weak, nonatomic) IBOutlet UILabel *focusLab;
@property (weak, nonatomic) IBOutlet UILabel *funsLab;

@end

@implementation HomeCommendClubCell

- (void)awakeFromNib {
    [super awakeFromNib];
}

- (void)setModel:(HomeCommendDetailModel *)model
{
    _model = model;
    [self.imgView sd_setImageWithURL:[NSURL URLWithString:model.thumbnail] placeholderImage:GetImage(@"default_goods_image")];
    self.nameLab.text = model.title;
    self.desLab.text = model.content;
    
    NSInteger count = [NSString stringWithFormat:@"%zd",model.keepCount].length;
    NSString *str = [NSString stringWithFormat:@"%zd关注",model.keepCount];
    NSMutableAttributedString *attrStr = [[NSMutableAttributedString alloc]initWithString:str];
    [attrStr addAttributes:@{NSFontAttributeName:Font(11),NSForegroundColorAttributeName:[UIColor colorWithHexString:@"#3285ff"]} range:NSMakeRange(0, count)];
    [attrStr addAttributes:@{NSFontAttributeName:Font(11),NSForegroundColorAttributeName:[UIColor colorWithHexString:@"#888888"]} range:NSMakeRange(count, str.length-count)];
    self.focusLab.attributedText = attrStr;
    
    NSInteger count1 = [NSString stringWithFormat:@"%zd",model.fans].length;
    NSString *str1 = [NSString stringWithFormat:@"%zd粉丝",model.fans];
    NSMutableAttributedString *attrStr1 = [[NSMutableAttributedString alloc]initWithString:str1];
    [attrStr1 addAttributes:@{NSFontAttributeName:Font(11),NSForegroundColorAttributeName:[UIColor colorWithHexString:@"#3285ff"]} range:NSMakeRange(0, count1)];
    [attrStr1 addAttributes:@{NSFontAttributeName:Font(11),NSForegroundColorAttributeName:[UIColor colorWithHexString:@"#888888"]} range:NSMakeRange(count1, str1.length-count1)];
    self.funsLab.attributedText = attrStr1;
}

@end
